﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using AspNetCs.Config;
using AspNetCs.IDAL;
namespace AspNetCs.DALFactory
{
    public class Conn
    {

        static Conn()
        {


        }
        public static string path
        {
            get
            {
                if (BaseConfig.GetBaseConfig().DbType.ToLower().Trim() == "sql")
                    return "AspNetCs.SQLServerDAL";
                else
                    return "AspNetCs.AccessDAL";
            }
        }
        /// <summary>
        /// 管理员
        /// </summary>
        /// <returns></returns>
        public static IAdmin CreateAdmin()
        {
            string ClassName = path + ".Admin_DAL";
            return (IAdmin)Assembly.Load(path).CreateInstance(ClassName);
        }
        /// <summary>
        /// 省份
        /// </summary>
        /// <returns></returns>
        public static IProvince CreateProvince()
        {
            string ClassName = path + ".Province_DAL";
            return (IProvince)Assembly.Load(path).CreateInstance(ClassName);

        }

        /// <summary>
        /// 城市
        /// </summary>
        /// <returns></returns>
        public static ICity CreateCity()
        {
            string ClassName = path + ".City_DAL";
            return (ICity)Assembly.Load(path).CreateInstance(ClassName);

        }
        /// <summary>
        /// 友情链接
        /// </summary>
        /// <returns></returns>
        public static IFriendSite CreateFriendSite()
        {
            string ClassName = path + ".FriendSite_DAL";
            return (IFriendSite)Assembly.Load(path).CreateInstance(ClassName);

        }
        /// <summary>
        /// 网站公告
        /// </summary>
        /// <returns></returns>
        public static IAnnounce CreateAnnounce()
        {
            string ClassName = path + ".Announce_DAL";
            return (IAnnounce)Assembly.Load(path).CreateInstance(ClassName);
        }


        /// <summary>
        /// 分页
        /// </summary>
        /// <returns></returns>
        public static IPager CreatePager()
        {
            string ClassName = path + ".Pager";
            return (IPager)Assembly.Load(path).CreateInstance(ClassName);
        }
        /// <summary>
        /// 调查
        /// </summary>
        /// <returns></returns>
        public static IVote CreateVote()
        {
            string ClassName = path + ".Vote_DAL";
            return (IVote)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 充值卡
        /// </summary>
        /// <returns></returns>
        public static IAddPoint CreateAddPoint()
        {
            string ClassName = path + ".AddPoint_DAL";
            return (IAddPoint)Assembly.Load(path).CreateInstance(ClassName);
        }



        /// <summary>
        /// 点数消费
        /// </summary>
        /// <returns></returns>
        public static IPoint_Log CreatePointLog()
        {
            string ClassName = path + ".Point_Log_DAL";
            return (IPoint_Log)Assembly.Load(path).CreateInstance(ClassName);
        }



        /// <summary>
        /// 新闻
        /// </summary>
        /// <returns></returns>
        public static IArticle CreateArticle()
        {
            string ClassName = path + ".Article_DAL";
            return (IArticle)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 出售馆号
        /// </summary>
        /// <returns></returns>
        public static ISaleNumber CreateSaleNumber()
        {
            string ClassName = path + ".SaleNumber_DAL";
            return (ISaleNumber)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 留言
        /// </summary>
        /// <returns></returns>
        public static IGuest CreateGuest()
        {
            string ClassName = path + ".Guest_DAL";
            return (IGuest)Assembly.Load(path).CreateInstance(ClassName);
        }


        /// <summary>
        /// 用户
        /// </summary>
        /// <returns></returns>
        public static IUser CreateUsers()
        {
            string ClassName = path + ".User_DAL";
            return (IUser)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 用户积分
        /// </summary>
        /// <returns></returns>
        public static IIntegral CreateIntegral()
        {
            string ClassName = path + ".Integral_DAL";
            return (IIntegral)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 纪念馆类型
        /// </summary>
        /// <returns></returns>
        public static IMemorial_Type CreateMemorial_Type()
        {
            string ClassName = path + ".Memorial_Type_DAL";
            return (IMemorial_Type)Assembly.Load(path).CreateInstance(ClassName);
        }
        public static IMemorial CreateMemorial()
        {
            string ClassName = path + ".Memorial_DAL";
            return (IMemorial)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 创建许愿墙数据库操作类实例
        /// </summary>
        /// <returns></returns>
        public static ILoveWall CreageLoveWall()
        {
            string ClassName = path + ".LoveWall_DAL";
            return (ILoveWall)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 创建网墓数据库操作类实例
        /// </summary>
        /// <returns></returns>
        public static INetMu CreateNetMu()
        {
            string ClassName = path + ".NetMu_DAL";
            return (INetMu)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 用户相册
        /// </summary>
        /// <returns></returns>
        public static IUserPhoto CreateUserPhoto()
        {
            string ClassName = path + ".UserPhoto_DAL";
            return (IUserPhoto)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 用户相册分类
        /// </summary>
        /// <returns></returns>
        public static IUserPhoto_Class CreatePhotoClass()
        {
            string ClassName = path + ".UserPhoto_class_DAL";
            return (IUserPhoto_Class)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 海外寻亲
        /// </summary>
        /// <returns></returns>
        public static IFindFamily CreateFindFamily()
        {
            string ClassName = path + ".FindFamilyDAL";
            return (IFindFamily)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 陵园
        /// </summary>
        /// <returns></returns>
        public static ICemetery CreateCemetery()
        {
            string ClassName = path + ".Cemetery_DAL";
            return (ICemetery)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 宠物乐园
        /// </summary>
        /// <returns></returns>
        public static IHappyPet CreateHappyPet()
        {
            string ClassName = path + ".HappyPet_DAL";
            return (IHappyPet)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 模板
        /// </summary>
        /// <returns></returns>
        public static ITemple CreateTemple()
        {
            string ClassName = path + ".Temple_DAL";
            return (ITemple)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 宗祠
        /// </summary>
        /// <returns></returns>
        public static IAncestralHall CreateAncestralHall()
        {
            string ClassName = path + ".AncestralHall_DAL";
            return (IAncestralHall)Assembly.Load(path).CreateInstance(ClassName);
        }
        /// <summary>
        /// 宗祠论坛
        /// </summary>
        /// <returns></returns>
        public static IAncestralHallBBS CreateAncestralHallBBS()
        {
            string ClassName = path + ".AncestralHallBBS_DAL";
            return (IAncestralHallBBS)Assembly.Load(path).CreateInstance(ClassName);
        }
        /// <summary>
        /// 宗祠版块
        /// </summary>
        /// <returns></returns>
        public static IAncestralHallItems CreateAncestralHallItems()
        {
            string ClassName = path + ".AncestralHallItems_DAL";
            return (IAncestralHallItems)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 代理商
        /// </summary>
        /// <returns></returns>
        public static IAgent CreateAgent()
        {
            string ClassName = path + ".AgentDAL";
            return (IAgent)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        ///  陵园添加纪念馆的墓点
        /// </summary>
        /// <returns></returns>
        public static ICemetery_AddNumId CreateCemetery_AddNumId()
        {
            string ClassName = path + ".Cemetery_AddNumId_DAL";
            return (ICemetery_AddNumId)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 分站配置
        /// </summary>
        /// <returns></returns>
        public static IPartSiteConfig CreatePartSiteConfig()
        {
            string ClassName = path + ".PartSiteConfig_DAL";
            return (IPartSiteConfig)Assembly.Load(path).CreateInstance(ClassName);
        }



        /// <summary>
        /// 祭祀列表
        /// </summary>
        /// <returns></returns>
        public static ISacrificeList CreateSacrificeList()
        {
            string ClassName = path + ".SacrificeList_DAL";
            return (ISacrificeList)Assembly.Load(path).CreateInstance(ClassName);
        }

        /// <summary>
        /// 背景音乐
        /// </summary>
        /// <returns></returns>
        public static IMusic CreateMusic()
        {
            string ClassName = path + ".MusicDAL";
            return (IMusic)Assembly.Load(path).CreateInstance(ClassName);
        }


        /// <summary>
        /// 站内短消息
        /// </summary>
        /// <returns></returns>
        public static IMessage CreateMessage()
        {
            string ClassName = path + ".Message_DAL";
            return (IMessage)Assembly.Load(path).CreateInstance(ClassName);
        }


        /// <summary>
        /// 捐助
        /// </summary>
        /// <returns></returns>
        public static IAlms CreateAlms()
        {
            string ClassName = path + ".Alms_DAl";
            return (IAlms)Assembly.Load(path).CreateInstance(ClassName);
        }


        /// <summary>
        /// 论坛帖子
        /// </summary>
        /// <returns></returns>
        public static IAncestralHallBBSMsg CreateAncestralHallBBSMsg_DAL()
        { 
            string ClassName = path + ".AncestralHallBBSMsg_DAL";
            return (IAncestralHallBBSMsg)Assembly.Load(path).CreateInstance(ClassName);
            
        }

        /// <summary>
        /// 论坛回帖
        /// </summary>
        /// <returns></returns>
        public static IAncestralHallBBSReplyMsg CreateAncestralHallBBSReplyMsg_DAL()
        {
            string ClassName = path + ".AncestralHallBBSReplyMsg_DAL";
            return (IAncestralHallBBSReplyMsg)Assembly.Load(path).CreateInstance(ClassName);

        }


        public static IExcuteSqlText CreateExcuteSqlText_DAL()
        {
            string ClassName = path + ".ExcuteSqlText_DAL";
            return (IExcuteSqlText)Assembly.Load(path).CreateInstance(ClassName);

        }

        public static IVideo CreateVideo()
        {
            string ClassName = path + ".Video_DAL";
            return (IVideo)Assembly.Load(path).CreateInstance(ClassName);

        }
        
        public static ILeaveInfo CreateLeaveInfo()
        {
            string ClassName = path + ".LeaveInfoDAL";
            return (ILeaveInfo)Assembly.Load(path).CreateInstance(ClassName);

        }
    }
}
